﻿@Html.Partial("_MainMenu")
<table class="table table-bordered table-striped" ng-init="workCtrl.loadTasks()">
    <thead>
        <tr>
            <th>
                Id
            </th>
            <th>
                Title
            </th>
            <th>
                <span class="visible-xs">E</span><span class="visible-md visible-sm visible-lg">Estimated Work</span>
            </th>
            <th>
                <span class="visible-xs">R</span><span class="visible-md visible-sm visible-lg">Remaining Work</span>
            </th>
            <th>
                <span class="visible-xs">C</span><span class="visible-md visible-sm visible-lg">Completed Work</span>
            </th>
            <th>
                <span class="visible-xs">T</span><span class="visible-md visible-sm visible-lg">Total Work</span>
            </th>
            <th>
                <span class="visible-xs">Td</span><span class="visible-md visible-sm visible-lg">Total Work Today</span>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat-start="taskByIterationPath in workCtrl.groupedTasks">
            <td class="header-group-1" colspan="7">
                <button type="button" class="btn btn-xs" ng-click="taskByIterationPath.isVisible = !taskByIterationPath.isVisible">
                    <span class="glyphicon" ng-class="{ 'glyphicon-chevron-up': taskByIterationPath.isVisible, 'glyphicon-chevron-down': !taskByIterationPath.isVisible }"></span>
                </button>
                {{ taskByIterationPath.iterationPath }}
            </td>
        </tr>
        <tr ng-repeat-start="taskByUserStory in taskByIterationPath.userStories" ng-show="taskByIterationPath.isVisible">
            <td class="header-group-2" colspan="7">
                <button type="button" class="btn btn-xs" ng-click="taskByUserStory.isVisible = !taskByUserStory.isVisible">
                    <span class="glyphicon" ng-class="{ 'glyphicon-chevron-up': taskByUserStory.isVisible, 'glyphicon-chevron-down': !taskByUserStory.isVisible }"></span>
                </button>
                {{ taskByUserStory.userStory }}
            </td>
        </tr>

        <tr class="item" ng-repeat="task in taskByUserStory.tasks" ng-show="taskByUserStory.isVisible">
            <td>{{ task.workItemId }}</td>
            <td>{{ task.title }}</td>
            <td>{{ task.estimatedWork }}</td>
            <td>{{ task.remainingWork}}</td>
            <td>{{ task.completedWork }}</td>
            <td>{{ task.totalWork }}</td>
            <td>{{ task.totalWorkToday }}</td>
        </tr>
        <tr ng-repeat-end></tr>
        <tr ng-repeat-end></tr>
    </tbody>
</table>